package com.example.light.system.controller;

import com.example.light.system.common.Result;
import com.example.light.system.entity.role;
import com.example.light.system.service.impl.IRoleService;
import com.example.light.system.vo.insertRolePermissionMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(description = "角色管理接口")
@RestController
@RequestMapping("/RoleController")
public class RoleController {
    @Resource
    IRoleService iRoleService;

    @ApiOperation("查询所有角色信息")
    @PostMapping("/searchAllRole")
    public Result<List<role>> searchAllRole(){
        return iRoleService.searchAllRole();
    }

    @ApiOperation("新增角色权限映射信息")
    @PostMapping("/addRolePermission")
    public Result<Integer> addRolePermission(@RequestBody insertRolePermissionMapper rolePermission){
        return iRoleService.addRolePermission(rolePermission);
    }
    }
